<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 50px;
            background-color: red;
        }
    </style>
</head>

<body>

    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>



    <script>
        var box = document.querySelectorAll('.box')
        //  console.log(box,box.length);
        //     for(var i=0;i<box.length;i++){
        //         box[i].index=i
        //          box[i].onclick=function(){
        //              console.log(this);
        //             console.log(this.index);
        //          }
        //     }


        var add = (function () {
         console.log(111111111);
            var counter = 0;

            return function () { return counter += 1; }

        })();
        console.log(add);
       
        console.log( add());
        console.log(new Array,'???');
    </script>
</body>

</html>